<?php
/*
 * Theme Name: 960Base Theme SIMPLE
 * Theme URI: http://960basetheme.kiuz.it
 * Description: Wordpress theme based on 960 Grid System
 * Author: Domenico Monaco
 * Author URI: http://www.kiuz.it
 * Version: 1.0.0 BETA
 */
?>

<?php 
	$city_name = get_city();
	$current_city = get_buzzr_cities($city_name);
	$city_id = $current_city[0]['id'];		
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head profile="http://gmpg.org/xfn/11">
	<link rel="shortcut icon" href="<?php echo BUZZR_THEME_URL.'/img/favicon.ico'; ?>">
	<link rel="icon" type="image/gif" href="<?php echo BUZZR_THEME_URL.'/img/animated_favicon1.gif'; ?>">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>
	  <?php 
	  global $pods; 
	  if(isset($pods->meta['title'])){
	    echo ($pods->meta['title'].' | Buzzr.in');  
	  }else{ 
	      wp_title(); 
	  } 
	  ?>
  	</title>
  	<link rel="stylesheet" href="<?php echo BUZZR_THEME_URL.'/style.css'; ?>" type="text/css" media="screen" />
	<link rel="pingback" href="http://buzzr.in/xmlrpc.php" />	
  	<?php wp_head(); ?>
	<script type="text/javascript">
		jQuery.noConflict();
		var buzzr_url = '<?php echo BUZZR_URL; ?>';
		var buzzr_wp_url = '<?php echo BUZZR_WP_URL; ?>';
	</script>
	<?php if(!current_user_can('administrator') && !current_user_can('moderator')){ ?>
	<!-- Google Analytics Code -->
	<script type="text/javascript">

	  var _gaq = _gaq || [];
	  _gaq.push(['_setAccount', 'UA-1717133-7']);
	  _gaq.push(['_trackPageview']);
	
	  (function() {
	    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	  })();
	
	</script>
	<!-- Google Analytics Code -->
	<?php } ?>
</head>

<body>

<?php $buzzr_cities = get_buzzr_cities(); ?>

<!-- Choose City -->
<div class="container_16" id="city_rest">
	<?php foreach($buzzr_cities as $city_val){ ?>
		<div class="city_drop">
			<a href="<?php echo BUZZR_URL.'/?city='.$city_val['name']; ?>"><?php echo $city_val['name']; ?></a>
		</div>
	<?php } ?>
	<div class="clear"></div>
</div>
<!-- Choose City -->
<div class="clear"></div>
	
<div id="img-head">
	<div id="branding"><a href="<?php echo BUZZR_URL; ?>"><img src="<?php echo BUZZR_THEME_URL.'/img/buzzrin-logo.png';  ?>" /></a></div>
	<div id="menu_deals">
		
		<div id="live_deals">
			<span class="city_name">
				<?php echo $city_name; ?> 
				<a href="#" class="change_city"><img src="<?php echo BUZZR_THEME_URL.'/img/down.png'; ?>" /></a>
			</span>
		</div>
		
		<div id="menu_tabs">
		  	<a href="<?php echo BUZZR_URL.'/deals'; ?>" class="tab_menu">Product Deals</a>
		    <a href="<?php echo BUZZR_URL.'/localoffers/'.strtolower($city_name); ?>" class="tab_menu">Local Deals</a>
		    <a href="<?php echo BUZZR_URL.'/blog'; ?>" class="tab_menu">Blog</a>
		</div>			
	</div>
	<div id="user_profile">
		
		<?php if(!is_user_logged_in()){ ?>
			<div class="header_login">
				<div id="fb_login" class="fleft"><?php jfb_output_facebook_btn(); ?></div>
				<div id="log_in_header" class="registration_buttons fleft"><a rel="nofollow" href="<?php echo BUZZR_WP_URL.'/wp-login.php'; ?>" class="simplemodal-login">Login</a></div>
				<div id="sign_up_header" class="registration_buttons fleft"><a href="<?php echo BUZZR_WP_URL.'/wp-login.php?action=register'; ?>">Sign Up</a></div>
			</div>
		<?php }else{ 
			$buzzrs_curent_user = buzzrs_current_user();
		?>
			<div class="header_login">
				<div id="logout" class="login_box fleft">
					<div class="user_image fleft"><a href="<?php echo $buzzrs_curent_user['profile_link']; ?>"><?php echo $buzzrs_curent_user['profile_pic']; ?></a></div>
					<div class="user_info fleft">
						<a href="<?php echo $buzzrs_curent_user['profile_link']; ?>" title="<?php echo $buzzrs_curent_user['name']; ?>"><?php echo $buzzrs_curent_user['short_name']; ?></a>
						<p>Pts: <?php echo $buzzrs_curent_user['total_points']; ?></p>
					</div>
					<div class="clear"></div>
				</div>
				<div class="user_options_drop fleft" >
					<?php if(!empty($buzzrs_curent_user['email_pref_link'])){ ?>
					<div class="user_edit"><a href="<?php echo $buzzrs_curent_user['email_pref_link']; ?>">Email Preferences</a></div>
					<?php } ?>
					
					<div class="user_edit"><a href="<?php echo BUZZR_URL.'/add-offer'; ?>">Add Offer</a></div>
					<div class="user_edit"><a href="<?php echo BUZZR_URL.'/get-points'; ?>">Get Points</a></div>
					
					<?php if($buzzrs_curent_user['is_admin']){ ?>
					<div class="user_edit"><a href="<?php echo $buzzrs_curent_user['stats']; ?>">Buzzr Stats</a></div>
					<div class="user_edit"><a href="<?php echo $buzzrs_curent_user['new_brand']; ?>">New Brand</a></div>
					<div class="user_edit"><a href="<?php echo $buzzrs_curent_user['new_coupon']; ?>">New Coupon</a></div>
					<div class="user_edit"><a href="<?php echo $buzzrs_curent_user['new_daily']; ?>">New Daily</a></div>
					<div class="user_edit"><a href="<?php echo $buzzrs_curent_user['new_deal']; ?>">New Deal</a></div>
                    <div class="user_edit"><a href="<?php echo $buzzrs_curent_user['categories']; ?>">Categorisation</a></div>
					<?php } ?>
					
					<div class="user_edit"><a href="<?php echo wp_logout_url(BUZZR_URL); ?>">Log out</a></div>
				</div>
				<a class="user_options">
					<img src="<?php echo BUZZR_THEME_URL.'/img/down.png'; ?>" id="down" />
				</a>
				<a class="user_options_close">
					<img src="<?php echo BUZZR_THEME_URL.'/img/close.png'; ?>" id="close" />
				</a>
				<div class="clear"></div>
			</div>
		<?php } ?>
		<div class="clear"></div>
		
		<div class="newsletter">
			 <?php $nonce = wp_create_nonce('newsletter_ajax'); ?>
			<p>Sign up for <?php echo $city_name; ?> Newsletter</p>
			<input id="email_header" name="newsletter_email" type="textbox" value="Email Address" class="header_email newsletter_email" />
			<input id="ajax_nonce_header" name="ajax_nonce" type="hidden" value="<?php echo $nonce; ?>" />
			<input id="signup_header" name="newsletter_signup" type="submit" value="Go">
			<input id="city_header" name="newsletter_city" type="hidden" value="<?php echo $city_id.'-'.$city_name; ?>" />
			<div id="loader_header" class="loader"><img src="<?php echo BUZZR_WP_URL.'/wp-content/pfiles/images/loader.gif'; ?>" /></div>
		</div>			
	</div>
</div><!-- END img-head -->
<div class="clear"></div>

<div id="wrapper" class="container_16" >
	<div id="top_bar" class="grid_16">
		<div id="head-region" class="header-widget">
			<?php	if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Header Region 0') ) : ?><?php endif; ?> 
		</div><!-- END head-widget -->
	</div><!-- END top_bar -->
	
	<div id="header" class="container_16">
		<div class="newsletter_result" id="result_header"></div>
		<!-- Search -->
		<div id="search-heading">
		
		<form method="get" id="searchform" action="<?php echo BUZZR_URL; ?>/">
		Find the Best deals for <input class="searchbar" type="text" size="50"  name="s" id="s" value="Enter Brand, Product or Keyword" /> in 
		    <select class="search_city" name="c" id="c">
		      <?php
		      foreach($buzzr_cities as $city_val){
		      	if($city_val['name'] == $city_name){ ?>
		      	<option selected="selected"><?php echo $city_val['name']; ?></option>
		      	<?php }else{ ?>
		      	<option><?php echo $city_val['name']; ?></option>
		      	<?php }
		      } 
		      ?>
			</select>
			<input type="submit" value="Search" class="g-button" id="search_header" />
		</form>
		<div class="grid_4 push_3">
			<p style="font: italic 12px Arial; color: gray;">eg. cleartrip, books</p>
		</div>
		<div class="clear"></div>
  		</div>
  		<!-- Search -->
  		
	</div><!-- END header -->
<div class="clear"></div>

	<div id="content_bar" class="grid_16">
		<div id="content-region" class="content-widget">
			<?php	if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Content Region 0') ) : ?><?php endif; ?> 
		</div><!-- END head-widget -->
	</div>
	
   <div id="content_wrapper" class="container_16">